/* This is the place to store common materials to render.
All object will get information here to render everything on its own.
*/
#pragma once
#include "GLES2\gl2.h"
#include "Shaders.h"
#include "..\Utilities\Utilities.h"
#define PI				3.14159265358979323846f
#define GetRenderer()	Renderer::GetInstance()

class StateMain;
class Renderer
{
protected:
	Renderer () {}
	~Renderer () { glDeleteBuffers(2, m_boIds); }

	/*implicit methods exist for the copy constructor and operator= and we want to forbid calling them.*/
	Renderer (const Renderer &){} 
	Renderer& operator = (const Renderer &){}

public:
	static void CreateInstance ()
    {
        if ( ms_pInstance == NULL )
		   ms_pInstance = new Renderer();
    }
	static Renderer * GetInstance () 
    {
	   return ms_pInstance;
    }
	static void DestroyInstance () 
    {
	   if ( ms_pInstance )
	   {
		 delete ms_pInstance;
		 ms_pInstance = NULL;
	   }
    }

	void		Init ();
	Shaders*	GetShader ();
	Matrix		GetCamMatrix ();
	GLuint*		GetModel ();

protected:
	static Renderer * ms_pInstance;
	
	GLuint		m_boIds[2];
	Shaders		m_shader;
	Matrix		m_camMatrix;
};